import request from '@/utils/request'

export const getUserList = (params) => {
  return request({
    url: '/users',
    method: 'get',
    params
  })
}

export const getUserDetail = (id) => {
  return request({
    url: `/users/${id}`,
    method: 'get'
  })
}

export const updateUser = (id, data) => {
  return request({
    url: `/users/${id}`,
    method: 'put',
    data
  })
}

export const changePassword = (id, data) => {
  return request({
    url: `/users/${id}/password`,
    method: 'put',
    data
  })
}

export const toggleUserStatus = (id) => {
  return request({
    url: `/users/${id}/toggle-status`,
    method: 'put'
  })
}

export const getVolunteerProfile = (userId) => {
  return request({
    url: `/users/${userId}/profile`,
    method: 'get'
  })
}

export const updateVolunteerProfile = (userId, data) => {
  return request({
    url: `/users/${userId}/profile`,
    method: 'put',
    data
  })
}

export const getVolunteerList = (params) => {
  return request({
    url: '/users/volunteers',
    method: 'get',
    params
  })
}

